<!DOCTYPE html>
<html>
<head>
<script>
function printmsg()
{
alert("此文档现在正在打印！");
}
</script>
</head>

<body >
    <p>    此文档现在正在打印！ </p>

    <input type="button"  onbeforeprint="printmsg()" value="打印">

</body>
</html>
